
import { Component } from 'react';

class Monkey extends Component {
    constructor(props){
        super(props);
        console.log( '[Monkey] constructor' );
        console.log( '\tprops: ' , this.props );
        this.state = {
            position: '五行山'
        }
    }
    static getDerivedStateFromProps(props, state){
        console.log( '[Monkey] static getDerivedStateFromProps' );
        console.log( '\tprops: ' , props );
        console.log( '\tstate: ' , state );
        return { position: '高老庄' } ;
    }
    render(){
        console.log( '[Monkey] render' );
        return (
            <div className="monkey">{ this.props.name } 在 { this.state.position }</div>
        )
    }
    componentDidMount(){
        console.log( '[Monkey] componentDidMount' );
    }
}

export default Monkey ;